<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="WEB-INF/facelets/template.xhtml">
        <ui:param name="title" value="Registrera användare" />
        <ui:define name="content">
            <h:form id="register-form">
                <p:focus />
                <h:panelGroup styleClass="register-body">
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-firstname" value="Förnamn"/>
                        <p:inputText 
                            id="reg-firstname"
                            value="#{Register.firstname}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-firstname"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-lastname" value="Efternamn"/>
                        <p:inputText 
                            id="reg-lastname"
                            value="#{Register.lastname}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-lastname"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-mail" value="Mailadress"/>
                        <p:inputText 
                            id="reg-mail"
                            value="#{Register.mail}"
                            styleClass="register-input inputText"
                            >
                            <f:validator validatorId="emailValidator" />
                        </p:inputText>
                        <h:message for="reg-mail"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-phone" value="Telefonnummer"/>
                        <p:inputText 
                            id="reg-phone"
                            value="#{Register.phone}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-phone"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-street" value="Gatuadress"/>
                        <p:inputText 
                            id="reg-street"
                            value="#{Register.street}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-street"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-zip" value="Postnummer"/>
                        <p:inputText 
                            id="reg-zip"
                            value="#{Register.zipCode}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-zip"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-city" value="Postort"/>
                        <p:inputText 
                            id="reg-city"
                            value="#{Register.city}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-city"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-username" value="Användarnamn"/>
                        <p:inputText 
                            id="reg-username"
                            value="#{Register.username}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-username"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-password" value="Lösenord"/>
                        <p:password
                            feedback="false"
                            minLength="3"
                            id="reg-password"
                            value="#{Register.password}"
                            styleClass="register-input inputText"
                            />
                        <p:message for="reg-password"/>
                    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <h:outputLabel styleClass="register-labels" for="reg-password2" value="Upprepa Lösenord"/>
                        <p:password
                            feedback="false"
                            minLength="3" 
                            id="reg-password2"
                            value="#{Register.password2}"
                            styleClass="register-input inputText"
                            />
                        <h:message for="reg-password2"/>
                    </h:panelGrid>
                    <p:commandButton actionListener="#{RegisterCtrl.register}" 
                                     value="Registrera" 
                                     action="onRegister" 
                                     styleClass="commandButton" update="@form"/>
                </h:panelGroup>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

